import axios from '@/api/axios'
import qs from 'qs'
import {fytestUrl, fileapiUrl} from '@/config/config'

export const getConfig = () => {
    // console.log(params)
    return new Promise((resolve,reject) => {
        var url = window.location.href
        console.log('config:',url)
        axios({
            url: fytestUrl + '/api/CommonApi/GetConfig?url=' + url,
            method: 'get'
        }).then(res => {
            resolve(res.data)
        })
    });
}

export const getAccessToken = () => {
    return new Promise((resolve,reject) => {
        axios({
            url: fytestUrl + '/api/CommonApi/GetTokenByCache',
        }).then(res => {
            resolve(res.data)
        })
    });
}

// 微信上传图片
export const uploadWechatImg = (data) => {
    // console.log(data)
    // debugger
    return new Promise((resolve,reject) => {
        axios({
            url: fileapiUrl + '/api/WechatFile/UploadClassZoneFile',
            method: 'post',
            data
        }).then(res => {
            resolve(res.data)
        }).catch(err => {
            
            reject(err)
        })
    });
}